package cn.momoky.ccool.utils;

import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class UUID {

    private static final String KEY = "CCOOL:UUID";
    private final RedisCommand command;

    public Long get() {
        return command.incr(KEY);
    }

    public boolean isExists() {
        return command.exists(KEY);
    }

    public void set(Long n) {
        command.set(KEY, n);
    }

}
